<template>
  <el-pagination
    background
    :current-page="currentPage"
    :page-sizes="[10, 20, 30, 40]"
    :page-size="limit"
    layout="total, sizes, prev, pager, next, jumper"
    :total="total"
    @size-change="handleSizeChange"
    @current-change="handleCurrentChange"
  />
</template>

<script>
export default {
  props: {
    currentPage: {
      type: Number,
      default: 1
    },
    limit: {
      type: Number,
      default: 10
    },
    total: {
      type: Number,
      default: 0
    }
  },
  methods: {
    handleSizeChange(val) {
      console.log(`每页 ${val} 条`)
      this.$emit('perpage', val)
      // currentPage = 1
      // limit = val
    },
    handleCurrentChange(val) {
      console.log(`当前页 ${val}`)
      this.$emit('docurrentpage', val)
    }
  }
}
</script>

<style>

</style>
